<?php 
require_once BASE_PATH.'application/models/basedao'.EXT;

class userDAO extends baseDAO {

	var $table = 'k2_users';
	var $key   = 'userID';
	var $sql   = '';

	function __construct()
	{
            
	    // Call the Model constructor
	    parent::__construct();
	}
	
	// Metodo que regresa a los usuarios de cierto grupo (Editorial, Columnista, etc)
	function getUsersByGroupID($groupID, $data=array()){
		
		//$this->_defaultSQL();
		$this->db->where('group',$groupID);
		$this->_sql($data);
		$query = $this->db->get($this->table);
		return $query->result();
		
	}
	
	
	function getPrimaryUserId($user_id){
		
		$this->db->select('id');
		$this->db->where('userID',$user_id);
		//$this->_sql($data);
		$query = $this->db->get($this->table);
		$result =  $query->row();
		return $result->id;
	}
	
}